<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!doctype html>
<html><!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="title" -->
<title>杂志</title>

<link rel="stylesheet" type="text/css" href="../css/index.css">
<link rel="shortcut icon" type="text/css" href="../images/favicon.ico"/>
<script src="../js/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/article.css">
<script type="text/javascript" src="js/article.js"></script>
<!-- InstanceEndEditable -->
<script>
	$(function(){
		$.post("../json/articleAction_findAllArticle",{'atype':''},function(data){
		/*	var str="";
  			$.each(data.rows,function(index,item){
  				if(item!=null){
  					str+="<li><div class='article_img'><img src=../"+item.aaddr+"></div><div class='article_des'>";
  	                str+="<p><a href='javascript:article("+item.aid+")'>"+item.aname+"</a></p><p id='article_des_p'>";
  	        		str+="作者:<span>"+item.aauthor+"</span><span>类型:</span>"+item.atype+"<span>发表时间:</span>"+item.atime+"</div></li>";
  				}
  			});
  			$("#article_left_ul").html("");
  			$("#article_left_ul").html(str);*/
		},"json");
	});

	function article(aid){
		$.post("../json/articleAction_getOneArticle",{'article.aid':aid},function(data){
			if(data.result==1){
				location.href="oneArticle.jsp?aid="+aid;
			}else if(data.result==0){
				alert("找不到...");
			}
		});
	}
	
	function type(atype){
		if(atype==1){
			atype=null;
		}else if(atype==2){
			atype="婚恋";
		}else if(atype==3){
			atype="亲子";
		}else if(atype==4){
			atype="职场";
		}else if(atype==5){
			atype="健康";
		}else if(atype==6){
			atype="科普";
		}
		$.post("../json/articleAction_findAllArticle",{'atype':atype},function(data){
			var str="";
  			$.each(data.rows,function(index,item){
  				if(item!=null){
  					str+="<li><div class='article_img'><img src=../"+item.aaddr+"></div><div class='article_des'>";
  	                str+="<p><a href='javascript:article("+item.aid+")'>"+item.aname+"</a></p><p id='article_des_p'>";
  	        		str+="作者:<span>"+item.aauthor+"</span><span>类型:</span>"+item.atype+"<span>发表时间:</span>"+item.atime+"</div></li>";
  				}
  			});
  			$("#article_left_ul").html("");
  			$("#article_left_ul").html(str);
		},"json");
	}
	
	$(window).scroll(function(){
		var length=$("#article_left_ul>li").length;
		if(length>=3){
			if($(document).scrollTop()>=$(document).height()-$(window).height()){//临界点
				$.post("../json/articleAction_getMoreArticle",{'length':length},function(data){
					var str="";
					$.each(data.rows,function(index,item){
		  				if(item!=null){
		  					str+="<li><div class='article_img'><img src=../"+item.aaddr+"></div><div class='article_des'>";
		  	                str+="<p><a href='javascript:article("+item.aid+")'>"+item.aname+"</a></p><p id='article_des_p'>";
		  	        		str+="作者:<span>"+item.aauthor+"</span><span>类型:</span>"+item.atype+"<span>发表时间:</span>"+item.atime+"</div></li>";
		  				}
		  			});
					$("#article_left_ul").append(str);
				},"json");
			}
		}
	});
	
</script>
</head>

<body>
<!--头部开始-->
<div class="header">
    <div class="logo">
        <a href="../index.jsp"><img src="../images/logo.png"></a>
    </div>
    <div class="nav">
        <ul>
            <li><a href="../index.jsp" class="tit">首页</a></li>
            <li><a href="../FM/FM.jsp" class="tit">心理FM</a></li>
            <li><a href="../moods/moods.jsp" class="tit">心情说</a></li>
            <li><a href="article.jsp" class="tit">杂志</a></li>
           <!-- <li><a href="../test/test.jsp" class="tit">测试</a></li> -->
           <li><a href="#" class="tit">测试</a></li>
            <li><a href="../smile/smile.jsp" class="tit">微笑墙</a></li>
        </ul>
    </div>
    <div class="reg">
        <ul>
        	<c:if test="${empty sessionScope.currentUser}">
	            <li><a href="login/login.html" id="login_logo">登录</a></li>
	            <li><span class="line"></span></li>
	            <li><a href="reg/reg.html" id="reg_logo">注册</a></li>
	       	</c:if>
	       	<c:if test="${!empty sessionScope.currentUser}">
	       		<li id="myli"><span>欢迎您</span>[<a href="userServlet?op=getPerInfo" style="color:yellow;font-size:12px;" id="user_email">${sessionScope.currentUser.w_email}</a>]
	       		<span id="myspan"></span>
	       		<div id="current_userInfo">
	       			<dl>
	       				<dd><a href="#">个人中心</a></dd>
	       				<dd><a href="#">发表说说</a></dd>
	       				<dd><a href="#">我的通知</a></dd>
	       				<dd><a href="exit.jsp">退&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;出</a></dd>
	       			</dl>
	       		</div>
	       		</li>
	       	</c:if>
	       	
        </ul>
    </div>
    <div class="sear">
        <form target="_blank" action="" method="get">
            <input type="text" class="text" name="sear" placeholder="搜索" />
            <input type="submit" class="submit" value="&#10140;"/>
        </form>
    </div>
</div>
<!--头部结束-->
<!-- InstanceBeginEditable name="content" -->
<div id="article_content">
	<div id="article_left">
    	<div id="article_left_head">
        	<ul>
            	<li style="border-bottom: 3px solid blue"><a href="javascript:type(1)" class="a_type" style="color:#3169B0;">全部</a></li>
                <li><a href="javascript:type(2)" class="a_type">婚恋</a></li>
                <li><a href="javascript:type(3)" class="a_type">亲子</a></li>
                <li><a href="javascript:type(4)" class="a_type">职场</a></li>
                <li><a href="javascript:type(5)" class="a_type">健康</a></li>
                <li><a href="javascript:type(6)" class="a_type">科普</a></li>
            </ul>
        </div>
        <div id="article_left_body">
        	<ul id="article_left_ul">
        	 <c:forEach items="${ sessionScope.currentArticle}" var="item" begin="0" end="2">
            	<li>
                	<div class="article_img">
                    	<img src="../${item.aaddr}">
                    </div>
                     <div class="article_des">
                    	<p><a href="javascript:article(${item.aid})">${item.aname}</a></p>
                        <p id="article_des_p">作者:<span>${item.aauthor}</span><span>类型:</span>${item.atype}<span>发表时间:</span>${item.atime}
                    </div>
                </li>
            </c:forEach>
                <!-- <li>
                	<div class="article_img">
                    	<img src="images/1.jpg">
                    </div>
                     <div class="article_des">
                    	<a href="#">这世上没有偶然，有的只是必然</a>
                         <p id="article_des_p"><span>高寒</span><span class="get_num">664</span><span class="zan_num">8</span></p>
                    </div>
                </li>
                
                 <li>
                	<div class="article_img">
                    	<img src="images/1.jpg">
                    </div>
                     <div class="article_des">
                    	<a href="#">这世上没有偶然，有的只是必然</a>
                         <p id="article_des_p"><span>高寒</span><span class="get_num">664</span><span class="zan_num">8</span></p>
                    </div>
                </li>-->
            </ul>
        </div>
        <div id="article_left_foot">
        	<p><a href="#">更多>></a></p>
        </div>
    </div>
    <div id="article_right">
        <div id="article_right_head">
        	<p class="article_right_head_title"><a>杂志推荐</a></p>
        </div>
        <div id="article_right_body">
        	<ul>
        	<c:forEach items="${ sessionScope.articleInfo}" var="item" begin="0" end="5">
            	<li>
                	<img src="../${item.aaddr}">
                    <div class="article_right_body_des">
                    	<ul>
                        	<li><a href="javascript:article(${item.aid})">${item.aname}</a></li>
                            <li>作者:<a href="#">${item.aauthor}</a></li>
                        </ul>
                    </div>
                </li>
            </c:forEach>
                <!--  
             	<li>
                	<img src="images/1.jpg">
                    <div class="article_right_body_des">
                    	<ul>
                        	<li><a>文章名</a></li>
                            <li><a>作者</a></li>
                        </ul>
                    </div>
                </li>
                
                <li>
                	<img src="images/1.jpg">
                    <div class="article_right_body_des">
                    	<ul>
                        	<li><a>文章名</a></li>
                            <li><a>作者</a></li>
                        </ul>
                    </div>
                </li>
                -->
            </ul>
        </div>
        <div id="article_right_foot">
        
        </div>
    </div>
</div>
<!-- InstanceEndEditable -->
<!--内容部分结束-->
<div id="footer">
  <div id="footer_content">
       	<div id="nav">
            <ul>
                <li><a href="#">关于我们</a></li>
                <li><a href="#">加入我们</a></li>
                <li><a href="#">联系我们</a></li>
                <li><a href="#">免责声明</a></li>
                <li><a href="#">友情链接</a></li>
                <li><a href="#">网站地图</a></li>
                <li><a href="#">手机版</a></li>
                <li><a href="#">手机应用</a></li>
                <li><a href="#" style="display: none">投稿</a></li>
            </ul>
        </div>
        <div id="links">
            <span>友情链接：</span>
            <ul>
                <li><a target="_blank" href="http://www.nlp.cn/">NLP心理学</a></li>
                <li><a target="_blank" href="http://zhidao.baidu.com/daily/">百度知道日报</a></li>
                <li><a target="_blank" href="http://iask.fh21.com.cn/">飞华问医生</a></li>
                <li><a target="_blank" href="http://www.dxsbb.com/">大学生网</a></li>
                <li><a target="_blank" href="http://yuwen.chazidian.com/">语文网</a></li>
                <li><a target="_blank" href="http://tag.120ask.com/"> 有问必答知识库</a></li>
                <li><a target="_blank" href="http://www.xinli001.com/zx/">心理咨询</a></li>
                <li><a target="_blank" href="http://wannianli.tianqi.com/">天气网</a></li>
                <li><a target="_blank" href="http://www.pm25.com/">绿色呼吸</a></li>
                <li><a target="_blank" href="http://www.vmovier.com/">V电影</a></li>
                <li><a target="_blank" href="http://iask.sina.com.cn/c/79.html ">爱问健康</a></li>
            </ul>
        </div>
        <div id="copyright">
            <div id="footer_1">
                &copy; 2015 All Rights Reserved. <a target="_blank" href="http://www.miibeian.gov.cn/">粤ICP备12051153号</a>
            </div>
            <div id="footer_2">
                <a href="#">
                    <img src="../images/footer_pic1.png" align="absmiddle" />
                </a>
                <a href="#">
                    <img src="../images/footer_pic2.png" align="absmiddle" />
                </a>
            </div>
        </div>
    </div>
</div>
</body>
<!-- InstanceEnd --></html>

